<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>FLV Video Player</title>
    <script th:src="@{/js/flv.js}" src="../static/video/flv.js"></script>
</head>
<body>

<!--controls-->
<video id="videoPlayer" th:style="'width:' + ${width} + 'px; height:' + ${height} + 'px;'" controls autoplay muted>
    Your browser is too old which doesn't support HTML5 video.
</video>

<script th:inline="javascript">
    (function () {
        var videoPath = /*[[${videoPath}]]*/ '';

        if (flvjs.isSupported()) {
            var videoElement = document.getElementById('videoPlayer');
            var flvPlayer = flvjs.createPlayer({
                type: 'flv',
                url: videoPath
            });

            flvPlayer.attachMediaElement(videoElement);
            flvPlayer.load();

            // 播放视频
            videoElement.play();
        } else {
            console.error('FLV not supported');
        }
    })();
</script>
</body>
</html>
